# pattern = re.compile()
# src_list = pattern.findall(content)

# 爬取图片素材
import urllib.request

url = 'http://sc.chinaz.com/tupian/shanshuifengjing.html'

headers = {
    'User-Agent': ' Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'
}

request = urllib.request.Request(url=url, headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode('utf-8')

# 解析
import re

pattern = re.compile('<a target="_blank" href=".*?" alt=".*?"><img src2="(.*?)" alt="(.*?)"></a>', re.S)
src_list = pattern.findall(content)

i = 0
for src in src_list:
    picture_url = src[0]
    suffix = picture_url.split('.')[-1]
    picture_name = './image/' + src[1] + '.' + suffix

    urllib.request.urlretrieve(url=picture_url, filename=picture_name)
